<script type="text/javascript" src="/js/my97datepicker/wdatepicker.js"></script> 
<div class="center">
	<div class="home">
    	<div class="home_left">
        	<?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
			<div class="replacerechargetop">
            	<i>银行汇款</i>
                <div class="replacerechargetname">
                	<h1>银行汇款</h1>
                    <p>如果您通过银行转账给悠奇,请您填写汇款信息,以便悠奇核实。</p>
                </div>
            </div>
			<div class="replacerechargetab">
            	<ul>
                	<li><a class="tab1" href="/member/transfer"><i></i>银行汇款信息填写</a></li>
                        <li class="tabon"><a class="tab1" href="/member/westernunion"><i></i>西联汇款信息填写</a></li>
                </ul>
            </div>
            <form action="/member/transferprocess" method="post" id="form1" enctype="multipart/form-data">
            <div class="apply">
            	<div class="applyts">
                	<i></i>请转账后，第一时间填写汇款信息，以便悠奇尽早核实！
                </div>
                <div class="applytable">
                	<table>
                    	<tr>
                            <td class="z">汇款方姓名：</td>
                            <td>
                            	<div class="input">
                                        <input class="required" type="text" name="remittanceName" id="remittanceName" placeholder="请输入汇款方姓名"/>
                                        <span id="remittanceNameMessage" style="display: none;"><font color="red">汇款方姓名不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">汇款方国家：</td>
                            <td>
                            	<div class="input">
                                        <input class="required" type="text" name="remittanceCountry" id="remittanceCountry" placeholder="请输入汇款方国家"/>
                                        <span id="remittanceCountryMessage" style="display: none;"><font color="red">汇款方国家不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">汇款时间：</td>
                            <td>
                            	<div class="input jine" id="stime">
                                    <input name="stime" class="required number" max="3000" type="text" id="stimeval" readonly/>
                                    <span id="stimevalMessage" style="display: none;"><font color="red">汇款时间不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                    	<tr>
                            <td class="z">汇款金额：</td>
                            <td>
                            	<div class="input jine">
                                    <input name="money" id="money" class="texting required number" max="2000" type="text" /><span>美元</span>
                                    <span id="moneyMessage" style="display: none;"><font color="red">输入的汇款金额不合法</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">监控号：</td>
                            <td>
                            	<div class="input">
                                        <input class="required" type="text" name="monitoring" id="monitoring" placeholder="请输入监控号"/>
                                        <span id="monitoringMessage1" style="display: none;"><font color="red">监控号不能为空</font></span>
                                        <span id="monitoringMessage2" style="display: none;"><font color="red">该监控号已存在</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">汇款凭证：</td>
                            <td>
                                    <input type="file" name="file" id="file"/>
                                    <span id="remittanceMessage" style="display: none;"><font color="red">汇款凭证不能为空</font></span>
                            </td>
                        </tr>
                    </table>
                    <div class="payjiner">
                        <input type="hidden" name="userId" value="<?php echo $this->user->Id; ?>" id="userId" />
                        <p><label id="chargeMsg"><span>汇款凭证是指：转账详情的截图</span></p>
                    </div>
                    <div class="submit">
                        <?php if($this->type == "success"){ ?>
                            <font size='4' color='green'>您的汇款信息提交成功，悠奇很快为您处理！</font>
                        <?php }else{ ?>    
                            <a class="next" href="javascript:send();"><span>提交汇款信息</span></a>
                        <?php } ?>
                    </div>
                </div>
            </div>
            </form>
        </div>    
    </div>
</div>

<script type="text/javascript">
$('.input label').click(function(){    
    $(this).parent().find(':input').focus().click();
    $(this).val("");
});
$('.input input').keyup(function(){
    if($(this).val()===''){
        $(this).prev().show();
    }else{
        $(this).prev().hide();
    }
});
$("#stimeval").click(function(){
    $(this).attr("class","timeselect t_on");
    WdatePicker({el:'stimeval',dateFmt:'yyyy年M月d日',vel:'stime',onpicked:function(){
            //$("#stime").attr("class","timeselect");
    }});
});
function checkForm(){
    if($('#remittanceName').val() === ""){
        $('#remittanceNameMessage').show();
        return false;
    }else{
        $('#remittanceNameMessage').hide();
    }
    if($('#remittanceCountry').val() === ""){
        $('#remittanceCountryMessage').show();
        return false;
    }else{
        $('#remittanceCountryMessage').hide();
    }
    if($('#stimeval').val() === ""){
        $('#stimevalMessage').show();
        return false;
    }else{
        $('#stimevalMessage').hide();
    }
    if(isNaN($('#money').val()) || $('#money').val() === ""){
        $('#moneyMessage').show();
        return false;
    }else{
        $('#moneyMessage').hide();
    }
    if($('#monitoring').val() === ""){
        $('#monitoringMessage1').show();
        return false;
    }else{
        $('#monitoringMessage1').hide();
    }
    if($('#file').val() === ""){
        $('#remittanceMessage').show();
        return false;
    }else{
        $('#remittanceMessage').hide();
    }
    if(!$("#monitoringMessage2").is(":hidden")){
        return false;
    }
    return true;
}
$("#monitoring").change(function(){
    var monitoring = $(this).val();
    if($('#monitoring').val().trim() === ""){
        $('#monitoringMessage1').show();
        return false;
    }
    $('#monitoringMessage1').hide();
    $.post(
        '/member/judgedealno',
        {'dealNo':monitoring},
        function (data){
            if(data === 1){
                $('#monitoringMessage2').show();
                return false;
            }else{
                $('#monitoringMessage1').hide();
                $('#monitoringMessage2').hide();
            }
        }
    );
});
function send(){    
    if(checkForm()){
        $('#stimeval').val($('#stime').val());
        $('.submit').html("<font size='4' color='red'>正在提交信息……</font>");
        $('#form1').submit();
        /*var remittanceParty = $('#remittanceParty').val();
        var remittanceName = $('#remittanceName').val();
        var bank = $('#bank').val();
        var stime = $('#stime').val();
        var money = $('#money').val();
        var file = $('#file').val();
        var userId = $('#userId').val();
        $.post(
            '/member/transferprocess',
            {'remittanceParty':remittanceParty,'remittanceName':remittanceName,'bank':bank,'stime':stime,'money':money,'file':file,'userId':userId},
            function (data){
                if(data === 1){
                    $('.submit').html("<font size='4' color='green'>您的汇款信息已经成功提交！</font>");
                }else{
                    $('.submit').html("<font size='4' color='red'>很抱歉，汇款信息提交失败！</font>");
                }
            }
        );*/
    }    
}
</script>